package com.example.demo.pojo;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.example.demo.pojo.Rule;

import static com.example.demo.pojo.Rule.*;


/**
 * @program:IntelliJ IDEA
 * @Description:商铺
 * @author:Mr.CheCheHuiBujianO
 * @data: 2023/5/24 16:19
 */
public class Store {

    private String name;//名称
    private String address;//地址
    private float size;//面积
    private HashMap<String, Staff> staffMap;//员工集

    public Store(String name, String address, float size) {
        this.name = name;
        this.address = address;
        this.size = size;
    }

    //预计客流模型
    private ArrayList<Double> passengerFlow;

    private ArrayList<Gene> group;


    //黑箱数据设定字段，这些规则由添加店的时候设置
//    //建议输入时最大人数不超过工作人员的 1/2 + 1
//    private double PRE_WORK_TIME = 0.5;//0.5的倍数，开门前PRE_WORK_TIME小时  a
//    private int STORE_SIZE_NEED_BEFORE = 50;// b
//    private double PASSENGER_FLOW_NEED = 3.8;//客流PASSENGER_FLOW_NEED  c
//    private int FREE_POPULATION = 1;//没人的时候FREE_POPULATION值班  d
//    private double AFT_WORK_TIME = 1.0;//0.5的倍数，关门后aftWork小时  e
//    private int STORE_SIZE_NEED_AFTER_1 = 50;//f
//    private int STORE_SIZE_NEED_AFTER_2 = 2;//g


    private GAGroup GAGroup;
    public GAGroup getGAGroup() {
        return GAGroup;
    }

    public void setGAGroup(GAGroup GAGroup) {
        this.GAGroup = GAGroup;
    }

    public ArrayList<Gene> getGroup() {
        return group;
    }

    public void setGroup(ArrayList<Gene> group) {
        this.group = group;
    }

    //构造方法
    public Store(String name, String address, float size, HashMap<String, Staff> staffMap) {
        this.name = name;
        this.address = address;
        this.size = size;
        this.staffMap = staffMap;

        int pre = (int) (PRE_WORK_TIME / 0.5);
        int later = (int) (AFT_WORK_TIME / 0.5);
        int len = pre + later + 24;

        ArrayList<Gene> geneArray = new ArrayList<>();
        for (Staff stu : staffMap.values()) {
            geneArray.add(stu.gene);
        }
        GAGroup = new GAGroup(geneArray);


        GAGroup.setLen(len);
        GAGroup.setSize(staffMap.size());
    }


    //getter setter
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public float getSize() {
        return size;
    }

    public HashMap<String, Staff> getstaffMap() {
        return staffMap;
    }

    public void setstaffMap(HashMap<String, Staff> staffMap) {
        this.staffMap = staffMap;
    }


    public void setSize(float size) {
        this.size = size;
    }


}
